﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Bas1a01
    {
        private int? _areacode;
		private string _areaname;
		private string _pcode;
		private string _muser;
		private string _listid;
		
        /// <summary>
        /// 区域代码
        /// </summary>
		public int? Areacode
		{
			get { return _areacode;	 }
			set { _areacode=value;	}
		}
        /// <summary>
        /// 区域名称
        /// </summary>
		public string Areaname
		{
			get { return _areaname;	 }
			set { _areaname=value;	}
		}
        /// <summary>
        /// 上级区域
        /// </summary>
		public string Pcode
		{
			get { return _pcode;	 }
			set { _pcode=value;	}
		}
        /// <summary>
        /// 用户标识
        /// </summary>
		public string Muser
		{
			get { return _muser;	 }
			set { _muser=value;	}
		}
        /// <summary>
        /// 主键标识
        /// </summary>
		public string Listid
		{
			get { return _listid;	 }
			set { _listid=value;	}
		}
		
		public static List<Bas1a01> GetBas1a01ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Bas1a01> list = new List<Bas1a01>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Bas1a01 model = GetBas1a01ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Bas1a01 GetBas1a01ByDataRow(DataRow dr)
		{
			Bas1a01 model = new Bas1a01(); //实例化Bas1a01
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("areacode")&&!(dr["areacode"] is System.DBNull))  
				model.Areacode = ( int)dr["areacode"];
			if (dcc.Contains("areaname")&&!(dr["areaname"] is System.DBNull))  
				model.Areaname = ( string)dr["areaname"];
			if (dcc.Contains("pcode")&&!(dr["pcode"] is System.DBNull))  
				model.Pcode = ( string)dr["pcode"];
			if (dcc.Contains("muser")&&!(dr["muser"] is System.DBNull))  
				model.Muser = ( string)dr["muser"];
			if (dcc.Contains("listid")&&!(dr["listid"] is System.DBNull))  
				model.Listid = ( string)dr["listid"];
			
			return model;
		}
    }
}
